import http from "~/utils/http";
export const getCourse = data => {
  return http({
    url: "course/list",
    method: "post",
    data
  });
};
export const getCourseDetailById = data => {
  return http({
    url: "course/getCourseDetails",
    method: "post",
    data
  });
};
// 获取直播课程章节
export const getLiveCourseChapter = data => {
  return http({
    url: "course/liveVideo",
    method: "post",
    data
  });
};
// 根据用户id获取用户直播课程章节列表
export const getLiveCourseChapterList = data => {
  return http({
    url: "course/liveVideo/list",
    method: "post",
    data
  });
};

// 获取首页展示直播课程章节
export const getLiveChapter = () => {
  return http({
    url: "course/liveCourse",
    method: "post",
  });
};
export const getBuyRecord = params => {
  return http({
    url: "buy/record/list",
    method: "get",
    params
  });
};
export const sendMessage = data => {
  return http({
    url: "client/chat",
    method: "post",
    data
  });
};
export const getCourseByMajor = data => {
  return http({
    url: "client/under/coursies",
    method: "post",
    data
  });
};
export const getMajorTreeCourse = data => {
  return http({
    url: "client/getMajorTreeCourse",
    method: "post",
    data
  });
};

export const uploadImg = data => {
  return http({
    url: "common/richtext/file-upload",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data;charset=UTF-8"
    },
    data
  });
};

export const getVideoUrl = url => {
  return http({
    url,
    method: "get"
  });
};


export const downloadReport = url => {
  return http({
      url: 'userReport/download',
      method: 'post',
      responseType: 'blob',
      data:{
          url
      },
  });
};
export const getRtcInfo = data => {
  return http({
    url: "web/rtcInfo/list",
    method: "post",
    data
  });
};
//成果报告
export const getExamineReportList = data => {
  return http({
      url: 'userReport/list',
      method: 'post',
      data
  });
};
//成果报告展示列表
export const getMyReport = data => {
  return http({
      url: 'report/getMyReport',
      method: 'post',
      data
  });
};
//成果报告提交
export const saveUserReport = data => {
  return http({
      url: 'userReport/user/submit',
      method: 'post',
      headers: {
        "Content-Type": "multipart/form-data;charset=UTF-8"
      },
      data
  });
};
//获取用户当天签到的课程列表
export const getSignInCourseList = () => {
  return http({
      url: 'course/signIn/getNowSignCourseByUser',
      method: 'get',
  });
};
//课程签到
export const saveCourseSignIn = data => {
  return http({
      url: 'course/signIn/save',
      method: 'post',
      data
  });
};
// 获取我的证书
export const getMyCertificate = userId => {
  return http({
      url: 'certificate/getCertificateByUserId?userId='+userId,
      method: 'get',
  });
};
// 根据证书编号查询证书
export const searchCertificate = data => {
  return http({
      url: 'certificate/getCertificateByCertificateNo',
      method: 'post',
      data
  });
};

// 课程评价
export const saveCourseComment = data => {
  return http({
      url: 'courseComment/save',
      method: 'post',
      data
  });
};
// 课程评价列表
export const getCourseCommentList = data => {
  return http({
      url: 'courseComment/getRateList',
      method: 'post',
      data
  });
};
// 课程评价统计数据
export const getCommentCount = data => {
  return http({
      url: 'courseComment/getRateByCourse',
      method: 'post',
      data
  });
};